# 构建阶段
FROM golang:1.21-alpine AS builder
WORKDIR /app
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o fileserver .

# 运行阶段
FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /app
COPY --from=builder /app/fileserver .
COPY static ./static
RUN mkdir uploads && chmod 777 uploads

EXPOSE 8080
CMD ["./fileserver"]